using UnityEngine;
using System.Collections;

public class Tie : MonoBehaviour {
	
	GameObject Player;
	Vector3 velocity = Vector3.zero;
	
	bool target_Player;
	
	GameObject target;
	
	public enum Behavior{
		Follow_Max_Speed,
		Follow_Min_Speed,
		Idle, NULL
	}
	Behavior currentBehavior;
	InnerCollision inner;
	OutterCollision outter;
	
	
	// Use this for initialization
	void Awake () {
		
		Player = GameObject.FindGameObjectWithTag("xwing");
		
		target_Player= true;
		
		currentBehavior = Behavior.Idle;
		inner = gameObject.GetComponentInChildren<InnerCollision>();
		outter = gameObject.GetComponentInChildren<OutterCollision>();
	}
	
	// Update is called once per frame
	void FixedUpdate () {
//		if(target_Player)
//			transform.LookAt(Player.transform.position);
//		else
//			transform.rotation = target.transform.rotation;
//				
//		if(inner.myBehavior){
//			currentBehavior = Behavior.Follow_Min_Speed;
//		}else if(outter.myBehavior){
//			currentBehavior = Behavior.Follow_Max_Speed;
//		}else{
//			currentBehavior = Behavior.Follow_Min_Speed;
//		}
//		
//		switch(currentBehavior){
//			case Behavior.Follow_Max_Speed:
//			transform.Translate(Vector3.forward*1.5f);
//			break;
//			case Behavior.Follow_Min_Speed:
//			transform.Translate(Vector3.forward);
//				break;
//			case Behavior.Idle:
//			
//				break;
//		}
	}
	
	void OnTriggerEnter(Collider collider){
		if(collider.transform.tag == "InnerCollider"){
			target = collider.transform.parent.gameObject;
			Debug.Log(target.name);
			target_Player = false;
		}
	}
	void OnTriggerExit(Collider collider){
		if(collider.transform.tag == "InnerCollider"){
			target_Player = true;
		}
	}
	
	
}
